<!DOCTYPE html>
<html lang="en" xmlns:th="www.thymeleaf.org">
<head>
<meta charset="UTF-8" />
<title>UPDATE RESTAURANT</title>
<link rel="stylesheet" href="../../css/bootstrap/bootstrap.css"
	th:href="@{/css/bootstrap/bootstrap.css}" />
<script src="../../js/jquery-1.11.2.js" th:src="@{/js/jquery-1.11.2.js}"></script>
<script src="../../js/restaurant.js" th:src="@{/js/restaurant.js}"></script>
<style>
@font-face {
	font-family: 'Glyphicons Halflings';
	src: url('../fonts/glyphicons-halflings-regular.eot');
	src: url('../fonts/glyphicons-halflings-regular.eot?#iefix')
		format('embedded-opentype'),
		url('../fonts/glyphicons-halflings-regular.woff') format('woff'),
		url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'),
		url('../fonts/glyphicons-halflings-regular.svg#glyphicons-halflingsregular')
		format('svg');
}
}
</style>
</head>
<body>
	<header></header>
	<nav class="navbar navbar-inverse">
		<div class="container-fluid">
			<div>
				<ul class="nav navbar-nav navbar-right">
					<li><a href="#"><span class="glyphicon glyphicon-search"></span>Sign
							Up</a></li>
					<li><a th:href="@{/j_spring_security_logout}"><span
							class="glyphicon glyphicon-log-out"></span>Logout</a></li>
				</ul>
			</div>
		</div>
	</nav>
	<section>
		<article class="container col-sm-10 col-sm-offset-1">
			<div id="error"></div>
			<ol class="breadcrumb">
				<li><a th:href="@{/adminaccount/home}">Home</a></li>
				<li><a th:href="@{/restaurant/list}">Restaurant</a></li>
				<li class="active">Update</li>
			</ol>
			<div class="panel panel-success">
				<div class="panel-heading">UPDATE RESTAURANT</div>
				<div class="panel-body">
					<form id="updaterestaurant" name="updaterestaurant" method="post"
						th:action="@{'/restaurant/update/' + ${res.restaurantId}}"
						onsubmit="return validateUpdateForm();"
						class="form-horizontal container col-sm-10 col-sm-offset-1">
						<div class="form-group">
							<label class="control-label col-sm-3" for="restaurantName">Restaurant
								Name:<span style="color: red">(*)</span>
							</label>
							<div class="col-sm-9">
								<input type="text" class="form-control" id="restaurantName"
									th:value="${res.restaurantName}" name="restaurantName"
									placeholder="Enter restaurant name" readonly="readonly" />
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-sm-3" for="restaurantTitle">Restaurant
								Title:</label>
							<div class="col-sm-9">
								<input type="text" class="form-control" id="restaurantTitle"
									th:value="${res.restaurantTitle}" name="restaurantTitle"
									placeholder="Enter restaurant title" />
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-sm-3" for="wardName">Ward
								Name:</label>
							<div class="col-sm-9">
								<input type="text" class="form-control" id="wardName"
									th:value="${res.wardName}" name="wardName"
									placeholder="Enter ward name" />
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-sm-3" for="restaurantImage">Restaurant
								Image:</label>
							<div class="col-sm-9">
								<input type="file" accept="image/*" class="form-control"
									id="resImg" name="resImg" onchange="showImage();" />
							</div>
						</div>
						<div class="form-group">
							<div id="imgs" class="col-sm-offset-3 col-sm-9">
								<img id="image" th:src="${res.restaurantImage}" />
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-sm-3" for="openTime">Open/
								Close Time:<span style="color: red">(*)</span>
							</label>
							<div class="col-sm-3">
								<input type="time" class="form-control" id="openTime"
									name="openTime" th:value="${res.openTime}" />
							</div>
							<div class="col-sm-offset-1 col-sm-3">
								<input type="time" class="form-control" id="closeTime"
									name="closeTime" th:value="${res.closeTime}" />
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-sm-3" for="deliveryPrice">Delivery
								Price:<span style="color: red">(*)</span>
							</label>
							<div class="col-sm-9">
								<input type="number" class="form-control" id="deliveryPrice"
									th:value="${res.deliveryPrice}" name="deliveryPrice"
									placeholder="Enter delivery price" />
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-sm-3" for="minOrder">Minimum
								Bill:<span style="color: red">(*)</span>
							</label>
							<div class="col-sm-9">
								<input type="number" class="form-control" id="minOrder"
									th:value="${res.minOrder}" name="minOrder"
									placeholder="Enter minimum bill" />
							</div>
						</div>
						<input type="hidden" id="cityId" name="cityId"
							th:value="${res.cityId}" /> <input type="hidden" id="district"
							name="district" th:value="${res.districtId}" />
						<div class="form-group">
							<label class="control-label col-sm-3" for="city">City/
								District<span style="color: red">(*)</span>
							</label>
							<div class="col-sm-3">
								<select id="city" name="city" class="form-control"
									onchange="getDistrict();">
									<option value="0">Chọn Thành Phố</option>
									<option th:each="city : ${cityList.entrySet()}"
										th:value="${city.key}" th:text="${city.value}"></option>
								</select>
							</div>
							<div class="col-sm-offset-1 col-sm-3">
								<select id="districtId" name="districtId" class="form-control">
									<option value="0">Chọn Quận</option>
									<option th:each="district : ${districtList.entrySet()}"
										th:value="${district.key}" th:text="${district.value}"></option>
								</select>
							</div>
						</div>
						<input type="hidden" id="deHome" name="deHome"
							th:value="${res.deliveryHome}" />
						<div class="form-group">
							<label class="control-label col-sm-3">Delivery Home:</label>
							<div class="col-sm-3">
								<div id="checkboxlist" class="form-control"
									style="height: 10em; width: 18em; overflow: auto;"></div>
							</div>
						</div>
						<input type="hidden" id="cate" name="cate"
							th:value="${res.categoryIds}" />
						<div class="form-group">
							<label class="control-label col-sm-3">Category:</label>
							<div class="col-sm-9">
								<div id="checkboxcategory" class="form-control"
									style="height: 12em; width: 20em; overflow: auto;">
									<div th:each="category : ${categoryList.entrySet()}">
										<input th:value="${category.key}" th:text="${category.value}"
											type="checkbox" class="cateIds" />
									</div>
								</div>
							</div>
						</div>
						<div class="form-group">
							<label class="control-label col-sm-3" for="restaurantNote">Notes:</label>
							<div class="col-sm-9">
								<textarea class="form-control" rows="3" id="restaurantNote"
									th:text="${res.restaurantNote}" name="restaurantNote"
									placeholder="Enter restaurant note"></textarea>
							</div>
						</div>
						<div class="form-group">
							<div class="col-sm-offset-3 col-sm-2">
								<button type="button" onclick="backPage()"
									class="btn btn-primary glyphicon glyphicon-backward">Back</button>
							</div>
							<div class="col-sm-offset-1 col-sm-3 pull-right">
								<a><button type="submit"
										onclick="getDeliveryHome();getCategoryIds();addInputImage();"
										class="btn btn-primary glyphicon glyphicon-edit">Update</button></a>
							</div>
						</div>
					</form>
				</div>
				<div class="panel-footer"></div>
			</div>
		</article>
	</section>
	<footer class="container col-sm-12">
		<ol class="breadcrumb text-center">
			<li class="active"><p>@copyright - University Of Information
					Technology - Spring + hibernate + css3 + html5</p></li>
		</ol>
	</footer>
	<script>
		var cityId = document.getElementById('cityId').value;
		var districtId = document.getElementById('district').value;
		$('#city option[value=' + cityId + ']').attr("selected", "selected");
		$('#districtId option[value=' + districtId + ']').attr("selected",
				"selected");
		getListCategoryIds();
		getListDeliveryHome();
	</script>
</body>
</html>